package org.nf.web.view;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletResponse;
import org.nf.web.servlet.ServletApi;
import org.nf.web.servlet.View;

import java.io.IOException;

/**
 * @author zhu
 * @date 2024-05-20
 */
public class DefaultView implements View {

    private final Object object;

    public DefaultView(final Object object) {
        this.object = object;
    }

    @Override
    public void render(ServletApi servletApi) throws ServletException, IOException {
        HttpServletResponse response = servletApi.resp();
        response.setContentType("text/plain;charset=utf-8");
        response.getWriter().println(object);
    }
}
